<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>file_3</title>
		<script type="text/javascript">
			function Hero(name,sex,age,hp,atk,def){
				this.name = name,
				this.sex = sex,
				this.age = age,
				this.hp = hp,
				this.atk = atk,
				this.def = def,
				this.sayHello = function(){
					console.log("打招呼");
					return 0;
				},
				this.run = function(){
					console.log("跑步");
					return 0;
				},
				this.restore = function(){
					console.log("恢复血量");
					return 0;
				},
				this.attack = function(hero){
					console.log(this.name + sex + age + hp +  "攻击其他英雄,");
					let arr = [];
					return 0;
				}
			}
			
			
			let hero1 = new Hero("张飞","男",19,100,30,45);
			let hero2 = new Hero("关羽","男",22,100,60,22);
			
			console.log(hero1.attack);
			console.log(hero2.attack);
		</script>
	</head>
	<body>
	</body>
</html>